.class Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;
.super Ljava/lang/Object;
.source "WeiboLogin.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/netease/newsreader/weibo/WeiboLogin;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "WebHandler"
.end annotation


# instance fields
.field final synthetic this$0:Lcom/netease/newsreader/weibo/WeiboLogin;


# direct methods
.method constructor <init>(Lcom/netease/newsreader/weibo/WeiboLogin;)V
    .locals 0
    .parameter

    .prologue
    .line 240
    iput-object p1, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public show(Ljava/lang/String;)V
    .locals 14
    .parameter "data"

    .prologue
    .line 242
    const-string v0, "<!-- verifier -->"

    .line 244
    .local v0, FLAG:Ljava/lang/String;
    invoke-virtual {p1, v0}, Ljava/lang/String;->indexOf(Ljava/lang/String;)I

    move-result v11

    invoke-virtual {v0}, Ljava/lang/String;->length()I

    move-result v12

    add-int v9, v11, v12

    .line 245
    .local v9, start:I
    invoke-virtual {p1, v0}, Ljava/lang/String;->lastIndexOf(Ljava/lang/String;)I

    move-result v4

    .line 247
    .local v4, end:I
    invoke-virtual {p1, v9, v4}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v11

    invoke-virtual {v11}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v10

    .line 250
    .local v10, verifier:Ljava/lang/String;
    :try_start_0
    new-instance v5, Lcom/netease/newsreader/weibo/YdNoteLoginHelper;

    invoke-direct {v5}, Lcom/netease/newsreader/weibo/YdNoteLoginHelper;-><init>()V

    .line 251
    .local v5, h:Lcom/netease/newsreader/weibo/YdNoteLoginHelper;
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-static {v11}, Lcom/netease/newsreader/weibo/WeiboLogin;->access$1(Lcom/netease/newsreader/weibo/WeiboLogin;)Ljava/lang/String;

    move-result-object v11

    iget-object v12, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-static {v12}, Lcom/netease/newsreader/weibo/WeiboLogin;->access$2(Lcom/netease/newsreader/weibo/WeiboLogin;)Ljava/lang/String;

    move-result-object v12

    invoke-virtual {v5, v11, v12, v10}, Lcom/netease/newsreader/weibo/YdNoteLoginHelper;->requestVerifier(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/util/Map;

    move-result-object v8

    .line 253
    .local v8, map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    const-string v11, "oauth_token"

    invoke-interface {v8, v11}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 254
    .local v1, auth_token:Ljava/lang/String;
    const-string v11, "oauth_token_secret"

    invoke-interface {v8, v11}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 256
    .local v2, auth_verifier:Ljava/lang/String;
    invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v11

    if-nez v11, :cond_0

    invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v11

    if-nez v11, :cond_0

    .line 257
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    iget-object v11, v11, Lcom/netease/newsreader/weibo/WeiboLogin;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v12, "delete from oauth_list where oauth_type=\'ydnote\'"

    invoke-virtual {v11, v12}, Landroid/database/sqlite/SQLiteDatabase;->execSQL(Ljava/lang/String;)V

    .line 259
    new-instance v6, Landroid/content/ContentValues;

    invoke-direct {v6}, Landroid/content/ContentValues;-><init>()V

    .line 260
    .local v6, initialValues:Landroid/content/ContentValues;
    const-string v11, "oauth_type"

    const-string v12, "ydnote"

    invoke-virtual {v6, v11, v12}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 261
    const-string v11, "oauth_token"

    invoke-virtual {v6, v11, v1}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 262
    const-string v11, "oauth_token_secret"

    invoke-virtual {v6, v11, v2}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 263
    const-string v11, "oauth_name"

    const-string v12, ""

    invoke-virtual {v6, v11, v12}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V

    .line 264
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    iget-object v11, v11, Lcom/netease/newsreader/weibo/WeiboLogin;->db:Landroid/database/sqlite/SQLiteDatabase;

    const-string v12, "oauth_list"

    const/4 v13, 0x0

    invoke-virtual {v11, v12, v13, v6}, Landroid/database/sqlite/SQLiteDatabase;->insert(Ljava/lang/String;Ljava/lang/String;Landroid/content/ContentValues;)J

    .line 266
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-static {v11}, Lcom/netease/newsreader/weibo/WeiboLogin;->access$3(Lcom/netease/newsreader/weibo/WeiboLogin;)Landroid/os/Handler;

    move-result-object v11

    const/4 v12, 0x1

    invoke-virtual {v11, v12}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    .line 268
    new-instance v7, Landroid/content/Intent;

    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    const-class v12, Lcom/netease/newsreader/activity/AccountSettingActivity;

    invoke-direct {v7, v11, v12}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 269
    .local v7, intent:Landroid/content/Intent;
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    const/4 v12, -0x1

    invoke-virtual {v11, v12, v7}, Lcom/netease/newsreader/weibo/WeiboLogin;->setResult(ILandroid/content/Intent;)V

    .line 270
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-virtual {v11}, Lcom/netease/newsreader/weibo/WeiboLogin;->finish()V

    .line 280
    .end local v1           #auth_token:Ljava/lang/String;
    .end local v2           #auth_verifier:Ljava/lang/String;
    .end local v5           #h:Lcom/netease/newsreader/weibo/YdNoteLoginHelper;
    .end local v6           #initialValues:Landroid/content/ContentValues;
    .end local v7           #intent:Landroid/content/Intent;
    .end local v8           #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    :goto_0
    return-void

    .line 273
    .restart local v1       #auth_token:Ljava/lang/String;
    .restart local v2       #auth_verifier:Ljava/lang/String;
    .restart local v5       #h:Lcom/netease/newsreader/weibo/YdNoteLoginHelper;
    .restart local v8       #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    :cond_0
    iget-object v11, p0, Lcom/netease/newsreader/weibo/WeiboLogin$WebHandler;->this$0:Lcom/netease/newsreader/weibo/WeiboLogin;

    invoke-static {v11}, Lcom/netease/newsreader/weibo/WeiboLogin;->access$3(Lcom/netease/newsreader/weibo/WeiboLogin;)Landroid/os/Handler;

    move-result-object v11

    const/4 v12, 0x2

    invoke-virtual {v11, v12}, Landroid/os/Handler;->sendEmptyMessage(I)Z
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 275
    .end local v1           #auth_token:Ljava/lang/String;
    .end local v2           #auth_verifier:Ljava/lang/String;
    .end local v5           #h:Lcom/netease/newsreader/weibo/YdNoteLoginHelper;
    .end local v8           #map:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    :catch_0
    move-exception v3

    .line 277
    .local v3, e:Ljava/lang/Exception;
    invoke-virtual {v3}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_0
.end method
